package com.xian.loop;

import java.util.Scanner;

public class DeadForDemo {
    public static void main(String[] args) {

        //死循环
//        for (;;) {
//            System.out.println("1111111");
//        }
        //死循环经典写法
//        while (true) {
//            System.out.println("1111111");
//        }

//        do {
//            System.out.println("1111111");
//        }while (true);


        System.out.println("-----------------------");
        //案例：密码验证

        int okPwd = 520;
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("请输入密码:");
            int pwd = sc.nextInt();
            if(pwd == okPwd){
                System.out.println("欢迎！！！");
                break;
            }else {
                System.out.println("密码错误!!!");
            }

        }

    }
}
